import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false

import router from './router'
import Typenav from '@/components/Typenav/index.vue'
import Carousel from '@/components/Carousel/index.vue'
import Pagination from '@/components/Pagination/index.vue';

Vue.component('Typenav', Typenav);//将左侧菜单注册为全局组件
Vue.component('Carousel', Carousel);//将轮播图注册为全局组件
Vue.component('Pagination',Pagination);//分页器注册为全局组件

import store from './store/index.js'
//引入mockServe.js--mock数据
import '@/mock/mockServe'

//引入轮播图
import 'swiper/css/swiper.css'

//****API的第二种使用方式 当不使用vux而是在组件中直接引入时，可以挂载到原型上,不用重复引入*/
import * as API from '@/api/index'

// 注册elementui 按需引入
import { Button, Dialog } from 'element-ui';
Vue.use(Button)
Vue.use(Dialog)

var a = 1;
new Vue({
  render: h => h(App), 
  router,
  store,
  beforeCreate() {
    Vue.prototype.$bus = this;
    Vue.prototype.$API = API;//挂载接口对象
  },
}).$mount('#app')
